<?php
    require_once './Class/GetGpw.php';
    require_once './Class/GetYahoo.php';

if($_GET['type'] == 'gpw')
{
    $dataIn = file_get_contents('in/gpwIn.xml');
    $xml=simplexml_load_string($dataIn) or die("Error: Cannot create object");
    $config = json_decode(json_encode((array)$xml), TRUE);
    
    $get = new GetGPW($config);
    $get->cutFromPost($config);
} 
else if($_GET['type'] == 'yahoo')
{
    $dataIn = file_get_contents('in/yahooIn.xml');
    $xml=simplexml_load_string($dataIn) or die("Error: Cannot create object");
    $config = json_decode(json_encode((array)$xml), TRUE);

    $get = new GetYahoo($config);
    $get->cutFromPost($config);
}

$name = $get->saveCsv();
echo '<a href="'.$name.'">'.$name.'</a>';
?>
